<?php
namespace frontend\controllers;

use Yii;
use yii\web\Controller;
use yii\data\Pagination;

/**
 * Hello controller
 */
class ResultController extends Controller
{
    public function init()
    {
        set_time_limit(0);
        parent::init();
    }
    
    
    public function actionCreateUrl()
    {
        //$page
        $count = (new \yii\db\Query())->from('datas')->count();
        $pagination = new Pagination(['totalCount' => $count]);
        $pagination->setPageSize(10);
        
        $rows = (new \yii\db\Query())
        ->select('*')
        ->from('datas')
        ->offset($pagination->getOffset())
        ->limit($pagination->limit)
        ->orderBy('id asc')
        ->all();
        
        if (empty($rows)) {
            echo "data empty\n\r";
            exit;
        }

        
        foreach ($rows as $k => $v) {
            
            
            
            
            if(strpos($v['msg'],'数据') == 0) {
                //数据
                echo 'curl -s "https://saas.fin-tech.cn/admin/index.php?g=Api&m=Callback&a=makeYunReport&userid='.$v['user_id'].'&yun_type=4&yun_token='.$v['token'].'"';
                echo "<br/><br/>";
            } else {
                
                //用户
                //1
                echo 'curl -s "https://saas.fin-tech.cn/admin/index.php?g=Api&m=Callback&a=makeYunReport&userid='.$v['user_id'].'&yun_type=4&yun_token='.$v['token'].'"';
                echo "<br/><br/>";
            }
                

        }
        
        echo "end";
    }
    
    
    
}